1. Field of the Invention
The present invention relates to a flash memory and a mapping control apparatus and method for the flash memory, and more particularly, to enabling efficient access to a flash memory by updating block state information, which is changed through logical operations required by a processor, in the flash memory based on a predetermined state transition algorithm and referring to the updated information upon read/write operations.
2. Description of the Related Art
A flash memory has an advantage of RAM (Random Access Memory) which data can be written into and deleted from freely as well as that of ROM (Read Only Memory) that can maintain data stored therein without power. Therefore, flash memory has been widely used as a storage medium for portable electronic devices such as digital cameras, PDAs and MP3 players.
In such a flash memory, random access can be utilized for data stored in a specific location as in conventional RAMs, non-volatile storage devices, magnetic media and the like. However, the flash memory differs from existing storage devices in that access is gained on a block basis during the process of modifying or erasing data.
In other words, if previous data are intended to be modified or erased, it is required that a block containing the corresponding data be erased and data be then written again. As an example, it is performed in the same manner that an entire word is deleted completely by pressing the ‘Delete’ key and a modified word is then retyped instead of correcting a character or letter one-by-one.
As used herein, the term ‘sector’ refers to bytes having physically consecutive addresses. The sector is a basic unit of a read/write operation on a flash memory. A block including a plurality of sectors is a basic unit of a delete operation, which can be erased through a single erase operation.
Such a flash memory supports a logical-physical mapping method by which even though a physical address of a piece of data written in a flash memory is changed due to the erase-before-write, the piece of data written in the flash memory can be accessed with the same logical address.
That is, the mapping scheme manages information on mapping between a logical address and a physical address for a specific piece of data by means of a predetermined mapping table. The mapping scheme is classified roughly into a sector mapping method, a block mapping method, and a hybrid method.
FIG. 1A schematically illustrates an access architecture for a flash memory in accordance with a conventional sector mapping method.
As shown in FIG. 1A, the sector mapping method maintains mapping information on a sector basis in a flash memory to enable access to a physical sector of the flash memory using logical sector information.
As an example, if a logical sector number (LSN) is designated as 9 together with a request for a write operation of specific data, a flash memory access device searches for physical sector number (PSN) 6 corresponding to LSN 9 by referring to a mapping table.
Then, the relevant data are written in sector 6 of the flash memory. If other data have been written in this sector, the data are written in an empty physical sector of the flash memory and PSN corresponding to LSN 9 is changed in the mapping table.
FIG. 1B schematically illustrates an access architecture for a flash memory in accordance with a conventional block mapping method.
As shown in FIG. 1B, the block mapping method maintains mapping information on a block basis in a flash memory and translates logical sector information into logical block information, thereby enabling access to a physical sector of the flash memory using the logical block information and offset information.
As an example, if an LSN is designated as 9 together with a request for a write operation of specific data, a flash memory access device calculates a logical block number (LBN) (i.e., 9/4=2) for LSN 9 and then a physical block number (PBN) corresponding to LBN by referring to a mapping table.
In such a case, data are written in a sector corresponding to Offset 1 within PBN 1 obtained by matching the offset of the logical block with that of the physical block.
If other data have been written in this sector, the flash memory access device writes data in an empty physical sector of the flash memory while matching the offsets and then changes PBN corresponding to LBN 2 in the mapping table.
At this time, effective data remaining in the existing PBN should be copied to a new PBN while matching the offsets.
FIG. 1C schematically illustrates an access architecture for a flash memory in accordance with a conventional hybrid mapping method.
As shown in FIG. 1C, the hybrid mapping method performs mapping on a block basis units as in the block mapping method and then stores sector mapping information in a physical block to obtain the property of the sector mapping.
As an example, if an LSN is designated as 9 together with a request for a write operation of specific data, a flash memory access device calculates an LBN (i.e., 9/4=2) for LSN 9 and then obtains PBN 1 corresponding to the LBN by referring to a mapping table.
Thereafter, the flash memory access device writes data in an empty sector of PBN 1 and writes LSN 9.
Among these conventional mapping methods, the sector mapping method has difficulty in being practically applied to flash memories since there is a great deal of mapping information required for maintenance on the sector basis in the flash memory.
Accordingly, recent technologies are based on the block mapping method that requires less mapping information.
However, since the offsets should be matched in the block mapping method, a new block should be allocated to write data in the same sector and even effective data of a different sector in the same block as well as those of the relevant sector should be copied if write operations frequently occur in the same sector. Thus, there is a problem in that write and erase operations frequently occur, resulting in considerable deterioration of the performance of the system.
Meanwhile, although the hybrid mapping method does not require matching of the offsets due to storage of the sector mapping information after block mapping has occurred, it has a problem in that a predetermined memory capacity for writing the sector mapping information should be secured and thus the required amount of memory increases compared to the block mapping method.
To solve the aforementioned problems in the prior art, Korean Laid-Open Patent Publication No. 2002-0092487 entitled “Method of Managing Flash Memory” that was previously proposed discloses prevention of degradation of the performance of a system even in an environment where data are frequently updated by allocating a specific log block and writing data, which require a write operation during an updating process, in the log block. However, the invention of the publication is not sufficient to prevent the performance of the flash memory system from deteriorating due to repeated write operations since write/erase operations are required during the process of transferring the data written in the log block to a data block.
Therefore, there is a need for a method of accessing a flash memory, which enables improvement of the performance of a flash memory system by reducing the number of write/erase operations involved in write operations requested by a processor.